package com.orphan.audit.service;


import com.orphan.util.dto.*;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MqClientService {
    @Autowired
    RabbitTemplate template;
    UsersFreezeDto usersFreezeDto=new UsersFreezeDto();
    //从MQ取出客户冻结信息
    @RabbitListener(queues = "queueUser")
    public void  getMessage(UsersManageDto usersManageDto){

        usersManageDto.setIsFrozen(1 + "");
        System.out.println("usersManageDto = " + usersManageDto);
        template.convertAndSend("supplierExchange","UsersFreezeReturn",usersManageDto);
    }

    //从MQ取出供应商注册信息
    @RabbitListener(queues = "supplierInfo")
    public void  getMessage(SupplierInfoDto supplierInfoDto){

        supplierInfoDto.setStatus("通过");
        supplierInfoDto.setRank(1);
        System.out.println("supplierInfoDto = " + supplierInfoDto);
        template.convertAndSend("supplierExchange","RegisterReturn",supplierInfoDto);
    }

//    //从MQ取出客户注册信息
//    @RabbitListener(queues = "supplierInfoReturn")
//    public void getMessage(SupplierFreezeDto supplierFreezeDto){
//        System.out.println("supplierFreezeDto = " + supplierFreezeDto);
//    }
    //从MQ取出客户注册信息
    
}
